package com.magenta.maxoptra.gis.distancematrix.commands;

import com.magenta.maxoptra.gis.distancematrix.CommandType;
import com.magenta.maxoptra.gis.distancematrix.DistanceMatrixDAO;
import com.magenta.maxoptra.gis.distancematrix.DistanceMatrixServiceProxy;
import com.magenta.maxoptra.gis.distancematrix.UpdateRequestType;

/**
 * @author Sergey Grachev
 */
final class StartGroup extends AbstractGroupCommand {

    StartGroup(final long groupId) {
        super(groupId);
    }

    @Override
    public void execute(final DistanceMatrixDAO db, final DistanceMatrixServiceProxy service) {
        groupContext.startUpdating();
    }

    @Override
    public CommandType getType() {
        return CommandType.START;
    }

    @Override
    public UpdateRequestType isRequireMatrixUpdating() {
        return UpdateRequestType.SCHEDULE;
    }

    @Override
    public boolean isRequireGroupLock() {
        return false;
    }

    @Override
    public String toString() {
        return "StartGroup{" +
                "groupId=" + groupId +
                '}';
    }
}
